package com.intelligent.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.intelligent.pojo.PurchaseSupplier;
import com.intelligent.service.PendingSupplierService;
import com.intelligent.utils.Result;
import com.intelligent.vo.SupplierPendingPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/supplier")
public class PendingSupplierController {

    @Autowired
    private PendingSupplierService pendingSupplierService;

    @PostMapping("/page")
    public Result<Page<PurchaseSupplier>> page(@RequestBody SupplierPendingPage req){
        Page<PurchaseSupplier> page = pendingSupplierService.pagePending(req);
        return Result.success(page);
    }

    @GetMapping("/{id}")
    public Result<PurchaseSupplier> detail(@PathVariable Long id){
        return Result.success(pendingSupplierService.detail(id));
    }

    @PostMapping
    public Result<Boolean> create(@RequestBody PurchaseSupplier supplier){
        return Result.success(pendingSupplierService.createSupplier(supplier));
    }
}


